export default {
  name: 'company',
  components: {
    cash: () => import('./cash/cash.vue'),
    account: () => import('./account/account.vue'),
    apply: () => import('./apply/index.vue'),
    socialRefundApl: () => import('./socialRefundApl/refundApl.vue'),
    bonusPoint: () => import('./bonusPoint/bonusPoint.vue'),
    Recharge: () => import('./Recharge/Recharge.vue'),
	returnFee: () => import('./returnFee/index.vue')
  },
  data() {
    return {
      Active: '1',
      dialogVisible: false,
      global: {},
      tabs: [],
      tabPower: {
        czjl: false,
        dgzhcz: false,
        hytx: false,
        qytk: false,
        jljf: false,
        ewjljf: false
      },
	  msg:{
		  hytx:0,
		  qytk:0,
		  jljf:0,
	  }
    }
  },
  created() {
    this.global = this.GLOBAL
    let permisstions = this.GLOBAL.permisstions
    permisstions.forEach(item => {
      if (item.power == 5) {
        this.tabs = item.tablelist;
		console.log(this.tabs);
        this.tabs.forEach(items => {
          if (items.table == '5001') {
            this.tabPower.czjl = true
          } else if (items.table == '5002') {
            this.tabPower.dgzhcz = true
          } else if (items.table == '5003') {
            this.tabPower.hytx = true
          } else if (items.table == '5004') {
            this.tabPower.qytk = true
          } else if (items.table == '5005') {
            this.tabPower.jljf = true
          } else if (items.table == '5006') {
            this.tabPower.ewjljf = true
          }
        })
      }
    })
    if (!this.tabPower.czjl && this.tabPower.dgzhcz) {
      this.Active = '2'
    } else if (
      !this.tabPower.czjl &&
      !this.tabPower.dgzhcz &&
      this.tabPower.hytx
    ) {
      this.Active = '3'
    } else if (
      !this.tabPower.czjl &&
      !this.tabPower.dgzhcz &&
      !this.tabPower.hytx &&
      this.tabPower.qytk
    ) {
      this.Active = '4'
    } else if (
      !this.tabPower.czjl &&
      !this.tabPower.dgzhcz &&
      !this.tabPower.hytx &&
      !this.tabPower.qytk &&
      this.tabPower.jljf
    ) {
      this.Active = '5'
    } else if (
      !this.tabPower.czjl &&
      !this.tabPower.dgzhcz &&
      !this.tabPower.hytx &&
      !this.tabPower.qytk &&
      !this.tabPower.jljf &&
      this.tabPower.ewjljf
    ) {
      this.Active = '6'
    }
	console.log(this.tabs);
	if(this.tabs.length>2){
		this.$set(this.tabs[2],'totalNum',0);
		this.msg.hytx = this.tabs[2].totalNum;
		this.$set(this.tabs[3],'totalNum',0);
		this.msg.qytk = this.tabs[3].totalNum;
		this.$set(this.tabs[4],'totalNum',0);
		this.msg.jljf = this.tabs[4].totalNum;
	}
	
  },

  methods: {
    ActiveCash(active) {
      this.Active = active
    }
  }
}
